﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using SystemDiagramNew.TypeDefinition;

namespace SystemDiagramNew.SystemDiagramLegend
{
	public struct FillRegion
	{
		public FillRegion(FillRegion rhs)
		{
			this.m_EdgeLoop = rhs.m_EdgeLoop;
			this.m_Color = rhs.Color;
		}

		public FillRegion(List<EdgeInfo> edgeLoop, PenColor color)
		{
			this.m_EdgeLoop = edgeLoop;
			this.m_Color = color;
		}

		public List<EdgeInfo> EdgeLoop
		{
			get
			{
				return this.m_EdgeLoop;
			}
		}

		public PenColor Color
		{
			get
			{
				return this.m_Color;
			}
		}

		public bool IsNull()
		{
			return this.m_EdgeLoop == null;
		}

		public void ScalingTransformation(Transform transform)
		{
			foreach (EdgeInfo edgeInfo in this.m_EdgeLoop)
			{
				XYZ startPoint = Geometry.TransformPoint(edgeInfo.StartPoint, transform);
				XYZ endPoint = Geometry.TransformPoint(edgeInfo.EndPoint, transform);
				edgeInfo.StartPoint = startPoint;
				edgeInfo.EndPoint = endPoint;
			}
		}

		private readonly PenColor m_Color;

		private readonly List<EdgeInfo> m_EdgeLoop;
	}
}
